const express = require( 'express' );
const bodyParser = require( 'body-parser' );
const { join } = require( 'path' );

const app = express();
app.listen( 8080 );
app.use( express.static( 'web' ) );
app.use( bodyParser.urlencoded( { extended: false } ) );

// 指定art-template模板，并指定模块后缀为.html
app.engine( 'html', require( 'express-art-template' ) );
// 指定模板视图路径
app.set( 'views', join( __dirname, 'web' ) );
// 省略指定模块文件后缀后名称
app.set( 'view engine', 'html' );

//子路由
app.use( '/admin', require( './router/admin' ) );
app.use( '/db', require( './router/get' ) );
app.use( '/db', require( './router/delete' ) );
app.use( '/db', require( './router/put' ) );
app.use( '/db', require( './router/search' ) );
app.use('/db',require('./router/find'))

